 

function topListDetailCtrl($scope, $rootScope, $http) {
  'ngInject';
  let id = $state.params.id;
  let type = $state.params.type;
  this.type = type;
  // 提交表单
  this.submit = (param) => {
    // 修改表单是否提交过状态
    param.$submitted = true;

    // 表单校验
    if (param.$invalid) {
      return false;
    }
    let reqData = {
      listId: id,
      checkState: this.topDetailList.checkState,
      checkComment: this.topDetailList.checkComment,
    }
    
    $http.post(`${SERVER_CONTEXT}/api/redBlack/redBlackCheckRecord/insert/`,
      reqData
        )
      .then((resp) => {
        if(resp.data.success){
          $state.go('topListDetail',{type:'detail',id:id});
        }
      });

  };

  // 重置
  this.reset = () => {
    this.topDetailList = {};
  }
  // 获取红黑榜详情
	this.getBangList = () => {
    $http.get(`${SERVER_CONTEXT}/api/redBlack/redBlackList/select/${id}`)
      .then((resp) => {
        if(resp.statusText == 'OK'){
          this.topList = resp.data;
        }
      });
	}

  // 初始化页面
  this.initPage = () => {

    // 获取红榜榜详情
    this.getBangList();
  	
  }

  this.initPage();
}

export default topListDetailCtrl;